DH Migration Scripts Guide
DH Migration Scripts Guide
1. Overview
This document describes the command-line arguments supported by the DH Migration scripts.
The migration framework consists of the following scripts:
| Script | Purpose | Description |
|---|---|---|
| Extraction.sh | Extract migration data from the source environment. | Generates the migration package from the source environment. |
| Comparison.sh | Generate comparison reports in the destination environment. | Creates staging tables and generates the comparison report before migration. |
| Migration.sh | Execute migration and apply changes to the destination environment. | Performs the actual migration and updates the destination environment. |
| Rollback.sh | Revert migration changes and restore the previous state. | Rolls back comparison or migration changes when required. |
2. Migration Scripts
2.1 Extraction.sh
The Extraction script is executed on the source environment to generate the migration package.
2.1.1 Supported Arguments
| Argument | Description |
|---|---|
ConfigFile | Path to the configuration file containing database connection details and SH folder locations. |
MigrationType | Specifies the migration type. Supported values are full and incremental. |
AsOnDate | Cut-off date for data extraction. For full migration, specify the current date. For incremental migration, specify the date up to which data should be extracted from the source environment. |
2.1.2 Example
./Extraction.sh <ConfigFile> <MigrationType> <AsOnDate>
2.2 Comparison.sh
The Comparison script is executed on the destination environment to generate the migration comparison report.
2.2.1 Supported Arguments
| Argument | Description |
|---|---|
ConfigFile | Path to the configuration file containing database connection details and SH folder locations. |
MigrationType | Determines the migration mode.true → Incremental migrationfalse → Full migration |
AsOnDate | Cut-off date used during migration processing. For full migration, specify the current date. For incremental migration, specify the extraction date used on the source environment. |
2.2.2 Example
./Comparison.sh <ConfigFile> <MigrationType> <AsOnDate>
2.3 Migration.sh
The Migration script performs the actual migration and applies changes to the destination environment.
2.3.1 Supported Arguments
| Argument | Description |
|---|---|
ConfigFile | Path to the configuration file containing database connection details and SH folder locations. |
MigrationType | Determines the migration mode.true → Incremental migrationfalse → Full migration |
AsOnDate | Cut-off date used during migration processing. For full migration, specify the current date. For incremental migration, specify the extraction date used on the source environment. |
2.3.2 Example
./Migration.sh <ConfigFile> <MigrationType> <AsOnDate>
2.4 Rollback.sh
The Rollback script is used to revert migration-related changes.
2.4.1 Supported Arguments
| Argument | Description |
|---|---|
ConfigFile | Path to the configuration file containing database connection details and SH folder locations. |
Mode | Specifies the rollback mode.comparison → Removes only the staging tables created during comparison report generation.last → Restores data from backup tables to the main tables. |
FlowSide | Specifies whether the rollback is executed on the source or destination environment.src → Updates the latest migration record in DHMigration from Transferred to Reverted.dest → Updates the latest migration record in DHMigration from Received to Rollback. |
2.4.2 Example
./Rollback.sh <ConfigFile> <Mode> <FlowSide>
3. Configuration File
All migration scripts require a configuration file containing:
- Database connection details.
- Source and destination environment information.
- SH folder locations.
- Migration-specific configuration parameters.
Ensure that the configuration file is validated before executing any migration-related scripts.
4. Best Practices
- Verify the configuration file before execution.
- Use the same
AsOnDatevalue consistently throughout all migration steps. - Generate and review the comparison report before executing the migration.
- Take backups before running migration scripts.
- Use the rollback script whenever a migration must be reverted.
- Retain migration logs and generated reports for auditing and troubleshooting purposes.